package org.neogenesis.web.dao;

import java.rmi.RemoteException;

import org.apache.axis2.AxisFault;

import gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceStub;
import gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceStub.ESearchRequest;
import gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceStub.ESearchResult;
import gov.nih.nlm.ncbi.www.soap.eutils.EUtilsServiceStub.IdListType;

public class WebServiceCliente {

	public static void main(String[] args) {

		String query = "CCR1 OR DDR1 OR RFC2 AND \"Homo sapiens\"[organism]";

		try {
			EUtilsServiceStub service = new EUtilsServiceStub();

			ESearchRequest searchReq = new ESearchRequest();
			searchReq.setUsehistory("true");
			searchReq.setDb("gene");
			searchReq.setTerm(query);

			ESearchResult searchResp = service.run_eSearch(searchReq);

			IdListType resultId = searchResp.getIdList();
			String[] ids = resultId.getId();

			for (String string : ids) {
				System.out.println(string);
			}

		} catch (AxisFault e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}
